{"title":"Session.LogMessage(Text, Text, Verbosity, DataClassification, TelemetryScope, Dictionary of [Text, Text]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/session/session-logmessage-string-string-verbosity-dataclassification-telemetryscope-dictionary[text,text]-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/session/session-logmessage-string-string-verbosity-dataclassification-telemetryscope-dictionary[text,text]-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/session/session-logmessage-string-string-verbosity-dataclassification-telemetryscope-dictionary[text,text]-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Logs a trace message to a telemetry account.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":105,"chars":285},{"level":2,"title":"Parameters","slug":"parameters","at":390,"chars":854},{"level":2,"title":"Remarks","slug":"remarks","at":1244,"chars":184},{"level":2,"title":"Example","slug":"example","at":1428,"chars":474},{"level":2,"title":"Related information","slug":"related-information","at":1902,"chars":135}],"text":"> Version: _Available or changed with runtime version 5.4._\nLogs a trace message to a telemetry account.\n## Syntax\n```al\n Session.LogMessage(EventId: Text, Message: Text, Verbosity: Verbosity, DataClassification: DataClassification, TelemetryScope: TelemetryScope, CustomDimensions: Dictionary of [Text, Text])\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nEventId\nType: ../text/text-data-type\nThe event ID of trace message.\nMessage\nType: ../text/text-data-type\nThe message logged into telemetry.\nVerbosity\nType: ../verbosity/verbosity-option\nThe verbosity of the log.\nDataClassification\nType: DataClassification<../../../developer>\nClassification of data in message.\nTelemetryScope\nType: ../telemetryscope/telemetryscope-option\nSpecifies the scope of this trace message:\n ExtensionPublisher: Will emit this trace message to the Extension Publisher's telemetry account.\n All: Will emit this trace message additionally to the Partner's telemetry account.\nCustomDimensions\nType: Dictionary of [Text, Text]<../dictionary/dictionary-data-type>\nSet of additional dimensions, specified as a dictionary, that will be emitted to the telemetry account and that can be used to specify filters in the query.\n## Remarks\nFor more information about using this method, see Creating Custom Telemetry Events for Application Insights<../../devenv-instrument-application-for-telemetry-app-insights>.\n## Example\n```al\ntrigger OnRun();\nvar\n    CustomDimensions: Dictionary of [Text, Text];\nbegin\n    CustomDimensions.Add('result', 'failed');\n    CustomDimensions.Add('reason', 'critical error in code');\n    CustomDimensions.Add('alCallstack', \"Error Message Management\".GetCurrCallStack());\n    LogMessage('MyExt-0001', 'This is a critical error message', Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, CustomDimensions);\nend;\n```\n## Related information\nsession-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}